import {onBeforeUnmount, onMounted, reactive} from "vue";

export default function () {
    const point = reactive({
        x: 0,
        y: 0
    })

    const changePoint = (e) => {
        point.x = e.pageX;
        point.y = e.pageY;
    }

    onMounted(() => {
        window.addEventListener('click', changePoint)
    });

    onBeforeUnmount(() => {
        window.removeEventListener('click', changePoint)
    });

    return point;
}